package com.yuanchu.goods.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yuanchu.common.validator.ValidationGroups;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 商品分类表
 * 
 * @author adan
 * @email 2028038953@gmail.com
 * @date 2023-12-19 02:17:43
 */
@Data
@TableName("yoshop_category")
public class YoshopCategoryEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 商品分类ID
	 */
	@JsonProperty("category_id")
	@TableId
	private Integer categoryId;
	/**
	 * 分类名称
	 */
	@NotBlank(message = "分类名称不能为空", groups = {ValidationGroups.Insert.class})
	private String name;
	/**
	 * 上级分类ID
	 */
	@NotNull(message = "分类id不能为空", groups = {ValidationGroups.Insert.class})
	@JsonProperty("parent_id")
	private Integer parentId;
	/**
	 * 分类图片ID
	 */
	@JsonProperty("image_id")
	private Integer imageId;
	/**
	 * 状态(1显示 0隐藏)
	 */
	private Integer status;
	/**
	 * 排序方式(数字越小越靠前)
	 */
	private Integer sort;
	/**
	 * 商城ID
	 */
	@JsonProperty("store_id")
	private Integer storeId;
	/**
	 * 创建时间
	 */
	@JsonProperty("create_time")
	private long createTime;
	/**
	 * 更新时间
	 */
	@JsonProperty("update_time")
	private long updateTime;

	@TableField(exist = false) //表示数据库表中不存在
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private YoshopUploadFileEntity image;
	/**
	 * 子分类
	 */
	@TableField(exist = false) //表示数据库表中不存在
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<YoshopCategoryEntity> children;

}
